#include<iostream>
using namespace std;
class time
{
    int h,m;
public:
    time()
    {
        h=0;
        m=0;
    }
    time(int x,int y)
    {
        h=x;
        m=y;
    }
    void set(int x,int y)
    {
        h = x;
        m = y;
    }
   friend int operator-(time t1,time t2)
    { 
       return (t2.h-t1.h)*60+t2.m-t1.m;
    }
    
};
int main()
{
    int x,y,x1,y1,i=0,j,a[100]={0};
    time t1, t2;
    
    while(1)
    {   i++;
        cin >> x >> y >> x1 >> y1;
        cout << "x1: " << x << endl;
        cout << "y1: " << y << endl;
        cout << "x2: " << x1 << endl;
        cout << "y2: " << y1 << endl;
        if(i == 5) break;
        if(x==0 &&y==0&&x1==0&&y1==0)
        {
            break;
        }
        else
        {  
            t1.set(x, y);
            t2.set(x1, y1);
            a[i] = t1 - t2;
            
        }
        getchar();
    }
    for(j=1;j<=i;j++)
    {
        cout<<a[j]<<endl;
    }
    return 0;
}